<?php
/**
 * Created by PhpStorm.
 * User: User
 * Date: 2017/10/16
 * Time: 19:15
 */
class  Printer
{
   private  static  $obj=null;

   private  function  __construct()
   {


   }
   public  static  function  getInstance(){
       if(is_null(self::$obj)){
           self::$obj=new Printer();
       }
       return self::$obj;
   }
}

$p1=Printer::getInstance();
$p2=Printer::getInstance();
var_dump($p1);
var_dump($p2);
?>